<template>
  <xdh-layout
    :fixed="true"
    :west="{width:asideWidth}"
    :footer-in-main="true"
    :north="{height:asideHeight}"
    :east="false">
    <top-header slot="north" :show-title="asideWidth==='250px'" :menus-sys="menus.userMenus.set"></top-header>
    <sidebar slot="north" :width.sync="asideWidth" :data="menus.userMenus.menus" :props="sidebarProps"></sidebar>
    <div ref="main" class="app-layout__main">
      <!--<nav-tabs></nav-tabs>-->
      <div class="app-layout__content" ref="content">
        <keep-alive>
          <router-view></router-view>
        </keep-alive>
      </div>
    </div>
    <!--<copyright slot="south"></copyright>-->
  </xdh-layout>
</template>


<script>
  import XdhLayout from '../../widgets/xdh-layout'
  import TopHeader from '../../components/top-header.vue'
  // import NavTabs from '../../components/nav-tabs.vue'
  import Sidebar from '../../components/sidebar.vue'
  import {mapState} from 'vuex'
  // import Copyright from '../../components/system/copyright.vue'

  // const SYSTEM_STORE = 'systemTabs'
  export default {
    componentName: 'Layout',
    components: {
      XdhLayout,
      TopHeader,
      Sidebar
      // Copyright,
      // NavTabs
    },
    data() {
      return {
        asideWidth: '100%',
        asideHeight: '120px',
        tabsStoreName: 'systemTabs',
        sidebarProps: {
          id: 'url',
          text: 'name',
          icon: 'icon',
          children: 'list',
          path: 'url',
          type: 'openType'
        }
      }
    },
    mounted() {
    },
    computed: {
      ...mapState(['menus'])
      // hasNavTabs() {
      //   return (this.$store.state[this.tabsStoreName] &&
      //     this.$store.state[this.tabsStoreName].list.length > 0)
      // },
      // classes() {
      //   return {
      //     'has-nav-tabs': this.hasNavTabs
      //   }
      // },
      // userMenus() {
      //   return [
      //     {
      //       icon: 'iconfont icon-home',
      //       menuId: '1',
      //       name: '首页',
      //       orderNum: 1,
      //       parentId: '0',
      //       pkValue: '1',
      //       type: 0,
      //       url: '/'
      //     }]
      // }
    },
    beforeRouteLeave(to, from, next) {
      // if (this.$store.state[SYSTEM_STORE]) {
      //   this.$store.commit(`${SYSTEM_STORE}/clear`)
      // }
      next()
    }
  }
</script>
